package com.tbgov;

import com.tbgov.util.MD5Util;

import java.security.SecureRandom;
import java.util.Base64;

public class KeyGenerator {
    public static String generateStrongKey() {
        SecureRandom secureRandom = new SecureRandom();
        byte[] key = new byte[32]; // 256-bit key
        secureRandom.nextBytes(key);
        return Base64.getEncoder().encodeToString(key);
    }

    public static void main(String[] args) {
        // String secretKey = generateStrongKey();
        // System.out.println("Generated Secret Key: " + secretKey);
        try {
            String s = MD5Util.MD5("123456");
            System.out.println("s = " + s);
            String md5 = MD5Util.getMD5byBase64("0ab44bd43d6b18fcd5cd928d6faab1b8");
            System.out.println("md5 = " + md5);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
